package hibernate;



import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	
	static {
		try {
			AnnotationConfiguration config = new AnnotationConfiguration();
            config.addAnnotatedClass(modelo.Docente.class);
            config.addAnnotatedClass(modelo.Disponibilidad.class);
            config.addAnnotatedClass(modelo.Materia.class);
            config.addAnnotatedClass(modelo.Curso.class);
            config.addAnnotatedClass(modelo.HorasMateria.class);
            config.addAnnotatedClass(modelo.Cronograma.class);

            sessionFactory = config.buildSessionFactory();
		}catch (Throwable ex){
			System.err.println("Initial SessionFactory creation failed." + ex);
            throw new ExceptionInInitializerError(ex);
		}
	}
	
	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
